#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdlib.h>
#include<assert.h>
#include"Sqlst.h"
void CheckCapacity(STL* psl)
{
	assert(psl);
	if (psl->size == psl->capicity)
	{
		size_t newcapicity = psl->capicity == 0 ? 4 : psl->capicity * 2;
		psl->a = realloc(psl->a, newcapicity*sizeof(SLDatetype));
		psl->capicity = newcapicity;
	}
}


void PrintStl(STL* psl)
{
	assert(psl);
	for (int i = 0; i < psl->size; ++i)
	{
		printf("%d ", psl->a[i]);
	}
	printf("\n");
}

void SeqListPopBack(STL* psl, SLDatetype x)
{

	assert(psl);
	CheckCapacity(psl);
	psl->a[psl->size] = x;
	psl->size++;
}

	void SeqListInit(STL *psl)
	{
		assert(psl);
		psl->a = NULL;
		psl->size = psl->capicity = 0;
	}
	




void SeqListDestory(STL *psl)
{
	assert(psl);
	if (psl->a)
	{
		free(psl->a);
	}
	psl->a = NULL;
	psl->size = psl->capicity = 0;
}